Skip to content

report: print common items first for readability#27367

Closed
gengjiawen wants to merge 1 commit into
nodejs:masterfrom
gengjiawen:node_report_output
Closed

report: print common items first for readability#27367
gengjiawen wants to merge 1 commit into
nodejs:masterfrom
gengjiawen:node_report_output

Conversation

@gengjiawen

Copy link
Copy Markdown
Member

cc @richardlau

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. report Issues and PRs related to process.report. labels Apr 23, 2019
@gengjiawen gengjiawen changed the title report: print common item first for readability report: print common items first for readability Apr 23, 2019

@richardlau richardlau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the timer example in the docs too? Otherwise LGTM.

@gengjiawen

Copy link
Copy Markdown
Member Author

Can you update the timer example in the docs too? Otherwise LGTM.

I am not sure which part. Can you post a link or snippet ? Thanks.

@richardlau

Copy link
Copy Markdown
Member

Can you update the timer example in the docs too? Otherwise LGTM.

I am not sure which part. Can you post a link or snippet ? Thanks.

GitHub makes it hard to link to snippets in markdown docs but the timer handle info around L193.

@gengjiawen

Copy link
Copy Markdown
Member Author

GitHub makes it hard to link to snippets in markdown docs but the timer handle info around L193.

I see. I will try to fix it after I watched Avengers: Endgame tonight 😎.

@gengjiawen

Copy link
Copy Markdown
Member Author

@richardlau Fixed.

@jasnell

jasnell commented Apr 25, 2019

Copy link
Copy Markdown
Member

Hmm... are there no tests that are verifying the actual output here? I know there's quite a bit that's non-deterministic but there should at least be some validation in the test. Changing the order of these these should break at least something in the tests :-)

@richardlau

Copy link
Copy Markdown
Member

Hmm... are there no tests that are verifying the actual output here? I know there's quite a bit that's non-deterministic but there should at least be some validation in the test. Changing the order of these these should break at least something in the tests :-)

We have a test that verifies the libuv handle information (test/report/test-report-uv-handles.js) but it is not affected by reordering as it uses JSON.parse() to parse the report and tests the parsed data.

@jasnell

jasnell commented Apr 25, 2019

Copy link
Copy Markdown
Member

Hmm... ok, I think that's definitely something we can improve. A basic message type test that checks the unparsed output would be worthwhile

@gengjiawen

Copy link
Copy Markdown
Member Author

Hmm... ok, I think that's definitely something we can improve. A basic message type test that checks the unparsed output would be worthwhile

Is there any example I can reference for output key sort ?

@gengjiawen

gengjiawen commented Apr 25, 2019

Copy link
Copy Markdown
Member Author

Now we have nested structure like this, looks like more hard to match 😭

{
      "localEndpoint": {
        "host": "0.0.0.0",
        "port": 56288
      },
      "remoteEndpoint": null,
      "sendBufferSize": 9216,
      "recvBufferSize": 786896,
      "fd": 33,
      "type": "udp",
      "is_active": true,
      "is_referenced": true,
      "address": "0x0000000103507bf0"
    }
}

@gengjiawen

gengjiawen commented Apr 25, 2019

Copy link
Copy Markdown
Member Author

Will try something like this in test-report-uv-handles

    {
      const get_libuv = /"libuv":\s\[([\s\S]*?)\]/gm;
      const get_handle_inner = /{([\s\S]*?),*?}/gm;
      const libuv_handles_str = get_libuv.exec(stdout)[1];
      const libuv_handles_array = libuv_handles_str.match(get_handle_inner);

      libuv_handles_array.map(i => {
        // exclude nested structure
        if (i.includes('type')) {
          const handle_keys = i.match(/(".*"):/gm);
          assert(handle_keys[0], 'type');
          assert(handle_keys[1], 'is_active');
        }
      });
    }

@gengjiawen gengjiawen force-pushed the node_report_output branch 2 times, most recently from d6bef39 to 005d602 Compare April 25, 2019 13:58
@gengjiawen

gengjiawen commented Apr 25, 2019

Copy link
Copy Markdown
Member Author

Not know why this test keep failed on my win10, so just let's travis run the tests ...

Debugger attached.
assert.js:87
  throw new AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: Process exited unexpectedly with code1
    at ChildProcess.<anonymous> (D:\Developer\node\test\report\test-report-uv-handles.js:88:12)
    at ChildProcess.<anonymous> (D:\Developer\node\test\common\index.js:373:15)
    at ChildProcess.emit (events.js:194:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
Waiting for the debugger to disconnect..

@gengjiawen

Copy link
Copy Markdown
Member Author

@richardlau @jasnell I add related test and CI is green, can you review this again ? thanks.

@ZYSzys ZYSzys added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 27, 2019
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@targos

targos commented Apr 27, 2019

Copy link
Copy Markdown
Member

Landed in 38f3526

@targos targos closed this Apr 27, 2019
targos pushed a commit that referenced this pull request Apr 27, 2019
PR-URL: #27367
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
targos pushed a commit that referenced this pull request Apr 27, 2019
PR-URL: #27367
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
@targos targos mentioned this pull request Apr 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. report Issues and PRs related to process.report.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants